package paypal;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

public class Pay {
	public static String doExplicit(String senderEmail, String receiverEmail,
			String amount, String memo) {
		StringBuilder sRequest = Utils.getBaseStringRequest();

		try {
			sRequest.append("&actionType=");
			sRequest.append(URLEncoder.encode("PAY", "UTF-8"));

			sRequest.append("&memo=");
			sRequest.append(URLEncoder.encode(memo, "UTF-8"));
			sRequest.append("&receiverList.receiver(0).amount=");
			sRequest.append(URLEncoder.encode(amount, "UTF-8"));
			sRequest.append("&receiverList.receiver(0).email=");
			sRequest.append(URLEncoder.encode(receiverEmail, "UTF-8"));
			sRequest.append("&senderEmail=");
			sRequest.append(URLEncoder.encode(senderEmail, "UTF-8"));

		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}

		//return Utils.doWebRequest(Const.API_ENDPOINT_PAY, sRequest.toString());
		return Utils.doWebRequestNew(Const.API_ENDPOINT_PAY, sRequest.toString());
	}
}
